package tech.lq0.dreamaticvoyage.block.basic;

import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;

@SuppressWarnings("deprecation")
public class MagmaFukamizuLiebaBlock extends Block {

    public MagmaFukamizuLiebaBlock() {
        super(Properties.of().forceSolidOn().strength(5f, 10f).sound(SoundType.STONE).pushReaction(PushReaction.DESTROY));
    }

    @Override
    public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
        return Block.box(1.0D, 0.0D, 1.0D, 15.0D, 8.0D, 15.0D);
    }

    @Override
    public void stepOn(Level pLevel, BlockPos pPos, BlockState pState, Entity pEntity) {
        if (pEntity instanceof LivingEntity) {
            pEntity.hurt(pLevel.damageSources().hotFloor(), pEntity.isSteppingCarefully() ? 1.5F : 4.0F);
        }

        super.stepOn(pLevel, pPos, pState, pEntity);
    }

    @Override
    public float getSpeedFactor() {
        return 0.5F;
    }

    @Override
    public float getJumpFactor() {
        return 0.5F;
    }

    @Override
    public boolean isPathfindable(BlockState pState, BlockGetter pLevel, BlockPos pPos, PathComputationType pType) {
        return true;
    }
}
